﻿using BLL;
using Microsoft.AspNetCore.Mvc;

namespace TiboShop.Controllers
{
    public class UserController : Controller
    {
        private readonly BLLUser bllUser;
        public UserController(BLLUser user)
        {
            bllUser = user;
        }
        public IActionResult Index()
        {
            return View();
        }
        [HttpGet]
        public IActionResult GetAllUser()
        {
            return View(bllUser.GetAllUser());
        }
        [HttpPost]
        public IActionResult EditUser(int uid)
        {
            return View(bllUser.FindUserById(uid));
        }
        [HttpPost]
        public IActionResult ChangeUserIfo(int uid,string Name,string Telephone,string passWord,bool state,bool exist)
        {
       
            bllUser.ChangeUserIfo(uid, Name, Telephone, passWord, state, exist);
            return RedirectToAction("GetAllUser");
        }
    }
}
